<div class="modal-header">
    <button type="button" class="close" data-dismiss="modal" aria-hidden="true">&times;</button>
    <h4 class="modal-title">添加公司信息</h4>
</div>
<form id="defaultForm" method="post" class="form-horizontal" action="/system/customer_save">
    <div class="modal-body">

        <div class="form-group">
            <label class="col-lg-3 control-label">公司名称</label>
            <div class="col-lg-6">
                <input type="text" class="form-control" name="name" />
            </div>
        </div>

        <div class="form-group">
            <label class="col-lg-3 control-label">客户经理</label>
            <div class="col-lg-6">
                <select class="form-control" name="manager" >
                    <option value="">选择客户经理</option>
                    <option th:each="user:${users}" th:value="${user.id}" th:text="${user.name}" ></option>
                </select>
            </div>
        </div>

        <div class="form-group">
            <label class="col-lg-3 control-label">公司类型</label>
            <div class="col-lg-6">
                <select class="form-control" name="companyType">
                    <option th:each="parameter:${parameters}" th:value="${parameter.id}" th:text="${parameter.name}" ></option>
                </select>
            </div>
        </div>

        <div class="form-group">
            <label class="col-lg-3 control-label">公司电话</label>
            <div class="col-lg-6">
                <input type="text" class="form-control" name="companyTelephone" />
            </div>
        </div>

        <div class="form-group">
            <label class="col-lg-3 control-label">联系人</label>
            <div class="col-lg-6">
                <input type="text" class="form-control" name="contactName" />
            </div>
        </div>

        <div class="form-group">
            <label class="col-lg-3 control-label">联系人手机</label>
            <div class="col-lg-6">
                <input type="text" class="form-control" name="contactMobile" />
            </div>
        </div>

        <div class="form-group">
            <label class="col-lg-3 control-label">公司email</label>
            <div class="col-lg-6">
                <input type="text" class="form-control" name="email" />
            </div>
        </div>

        <div class="form-group">
            <label class="col-lg-3 control-label">公司地址</label>
            <div class="col-lg-6">
                <input type="text" class="form-control" name="address" />
            </div>
        </div>

        <div class="form-group">
            <label class="col-lg-3 control-label">公司法人</label>
            <div class="col-lg-6">
                <input type="text" class="form-control" name="legalPerson" />
            </div>
        </div>

        <div class="form-group">
            <label class="col-lg-3 control-label">工商号</label>
            <div class="col-lg-6">
                <input type="text" class="form-control" name="businessNumber" />
            </div>
        </div>

        <div class="form-group">
            <label class="col-lg-3 control-label">银行账号</label>
            <div class="col-lg-6">
                <input type="text" class="form-control" name="bankAccount" />
            </div>
        </div>

        <!--<div class="form-group">-->
            <!--<label class="col-lg-3 control-label">纳税人类型</label>-->
            <!--<div class="col-lg-6">-->
                <!--<select class="form-control" name="role">-->
                    <!--<option value="">选择角色</option>-->
                <!--</select>-->
            <!--</div>-->
        <!--</div>-->

        <div class="form-group">
            <label class="col-lg-3 control-label">备注</label>
            <div class="col-lg-6">
                <textarea  class="form-control" name="remark" />
            </div>
        </div>

    </div>
    <div class="modal-footer">
        <button type="button" class="btn btn-default" data-dismiss="modal">关闭</button>
        <button type="submit" class="btn btn-primary">保存</button>
    </div>
</form>

<script>
    //表单初始化
    initCheck();
    //添加验证
    $("#defaultForm").bootstrapValidator('addField','contactMobile',{
        validators: {
            notEmpty: {
                message: '手机不能为空'
            },
            stringLength: {
                min: 11,
                max: 11,
                message: '手机号码只能是11个字符'
            },
            regexp: {
                regexp: /^1[3|4|5|8][0-9]\d{4,8}$/,
                message: '不是正确的手机格式'
            }
        }
    });
    $("#defaultForm").bootstrapValidator('addField','manager',{
        validators: {
            notEmpty: {
                message: '客户经理不能为空'
            }
        }
    });

    $("#defaultForm").bootstrapValidator('addField','contactName',{
        validators: {
            notEmpty: {
                message: '联系人不能为空'
            }
        }
    });

</script>